#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
long long n,m,top,ans,a[N],ans1;
int main()
{
	freopen("road.in","r",stdin); 
	freopen("road.out","w",stdout); 
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	++n;
	while(n)
	{
		++top;
		if(n%2==1) a[top]=1,++ans;
		n/=2;
	}
	cout<<top+1<<" "<<ans+(top-1)*2<<'\n';
	for(int i=2;i<=top;++i)
	{
		if(top==i)
		{
			cout<<top-i+2<<" "<<114<<" "<<0<<'\n';
			cout<<top-i+2<<" "<<114<<" "<<(1<<(top-i))<<'\n';
			
		}
		else{
			cout<<top-i+2<<" "<<top-i+1<<" "<<0<<'\n';
			cout<<top-i+2<<" "<<top-i+1<<" "<<(1<<(top-i))<<'\n';
		}
	}
	for(int i=top;i>=1;--i)
	{
		if(a[i]==1)
		{
			if(i==1)
				cout<<1<<" "<<114<<" "<<ans1<<'\n';
			else
				cout<<1<<" "<<i<<" "<<ans1<<'\n';
			ans1+=(1<<(i-1));
		}
	}
	return 0;
}
